﻿using System;
using System.Text;

namespace dotHTML.HTML {
    /// <summary>
    /// Represents an unordered list of menu items.
    /// </summary>
    [Serializable]
    public class Menu : Element {
        /// <summary>
        /// Represents choices for the type of this menu.
        /// </summary>
        public enum TypeChoices {
            /// <summary>
            /// Represents the commands of a context menu.
            /// </summary>
            Context,
            /// <summary>
            /// Represents the items in a toolbar.
            /// </summary>
            Toolbar,
            /// <summary>
            /// Represents an unordered list.
            /// </summary>
            List
        }

        private TypeChoices? _type;
        private string _label;

        /// <summary>
        /// Determines the type of menu this is.
        /// </summary>
        public TypeChoices? Type {
            get { return _type; }
            set { _type = value; }
        }

        /// <summary>
        /// Determines the label of this menu.
        /// </summary>
        public string Label {
            get { return _label; }
            set { _label = value; }
        }

        /// <summary>
        /// Gets a formatted string of all child elements of this element.
        /// </summary>
        /// <param name="sb">The StringBuilder to write this element's child
        /// data to.</param>
        protected override void WriteLocalAttributes(StringBuilder sb) {
            AttributeWriter.Write(sb, _label, "label");
            AttributeWriter.Write(sb, _type, "type", true);
        }
    }
}
